package com.ghpt.controller;
import com.ghpt.pojo.ReCN;
import com.ghpt.service.ReCNService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/recn")
public class ReCNController {
    private final ReCNService reCNService;

    public ReCNController(ReCNService reCNService) {
        this.reCNService = reCNService;
    }
    @GetMapping("/{id}")
    public ReCN getReCNById(@PathVariable Long id) {
        System.out.println("结果是"+reCNService.findReCNById(id));
        return reCNService.findReCNById(id);
    }
    @PutMapping
    public int updateReCN(@RequestBody ReCN reCN) {
        return reCNService.updateById(reCN);
    }
}
